onBeacon

abstract fun onBeacon(beacon: Beacon)

Called when a beacon event is detected by the player.

The provided Beacon object contains detailed information about the detected beacon and the nature of the event. Implementers should first query getPingType on the received beacon object to understand the specific type of event that occurred (e.g., device entered beacon region, device exited region, proximity update).

Based on the event type and other beacon properties (like UUID, major/minor values, proximity, RSSI, telemetry data for Eddystone), applications can then:

  • Trigger specific content changes.
  • Log proximity events for analytics.
  • Initiate interactions with nearby devices or services.
  • Display location-relevant information.

Parameters

beacon

A non-null Beacon object containing the details of the detected beacon and the event type.

See also

Beacon.PingType

// Assuming PingType is an enum or set of constants in Beacon